<?php
/**
 * Created by PhpStorm.
 * User: 鲁力玮
 * Date: 2019/4/25
 * Time: 11:06
 */

namespace app\admin\model;

class Authgroup extends BaseModel
{
    protected $table='jc_auth_group';
    /**
     * 删除指定数据
     * @param $where
     * @return int
     */
    public function deleteByWhere($where)
    {
        return $this->where($where)->delete();
    }

    /**
     * 添加数据
     * @param array|mixed $data
     * @return bool|int|mixed|string
     */
    public function insert($data)
    {
        $result =  $this ->save($data);

        if($result===false){
            return false;
        } else{
            return true;
        }
    }
    /**
     * 修改表连接下的某个字段的值
     * @param $id
     * @param $data
     * @return int
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function updateByjin($where,$data)
    {
        $result = self::where($where)->update($data);
        if($result===false){
            return 3;
        } else{
            return 1;
        }
    }
}